package com.lpl.web.controllers;
import com.lpl.polo.qiandaos;
import com.lpl.polo.result;
import com.lpl.polo.selectDao;
import com.lpl.util.local;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/tian")
public class Quanta {

    @Autowired
    private com.lpl.mapper.chadao chadao;
    @Autowired
    private com.lpl.service.qiandao qiandao;
    //  签到接口
    @PostMapping("/dao")
    public result getCode(@RequestBody List<qiandaos> qiandaos){
        result res= qiandao.insertDao(qiandaos);
        return res;
    }

//    获取签到数据
@GetMapping("/getDao")
public result<selectDao> getDao() {
    Map<String, Object> A = local.get();
    String id = (String) A.get("id");

    selectDao u = chadao.selectUserdao(id);
    System.out.println(u);

    if (u != null) {
        return result.success(u);
    } else {
        return result.error("用户签到信息不存在");
    }
}

}
